import { defineStore } from "pinia";
import { getText } from "@/api/list"; //引入请求接口函数
import { TYPE } from "@/types/test/test";
// defineStore 接受两个参数
//  参数1：仓库的id（字符串）
//  参数2：options（对象）
export const useCounterStore = defineStore("counter", {
  state: () => {
    return {
      name: "z",
    };
  },
  actions: {
    async getText() {
      // 请求实例
      let reult = (await getText({ format: "json" })) as TYPE<number, string>;
      if (reult.code === 1) {
        return reult.content;
      } else {
        return reult;
      }
    },
  },
});

export default useCounterStore;
